home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
bitstrg
/
linvertb.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-01
|
619b
|
33 lines
/*
librairie : bitstrg
invertbit -- inversion de l'etat d'un bit
Le parametre nombre de bits est de type unsigned long
Attention : en Small Memory Model le champ Data est limite a 64Koctets
*/
#include "bitstrg.h"
/*
invert state of specified bit
if bit > map size, 0 is returned, else 1 is returned
*/
unsigned linvertbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */
{
if(ptr->numlbit < bit) {
return(0);
}
/* XOR original with 1 */
(ptr->pntarray)[bit / SIZE] ^= (1 << (bit & (SIZE - 1)));
return(1);
}